<html>
<head>
<meta charset="utf-8">
<meta
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
	name="viewport" />
<meta content="yes" name="apple-mobile-web-app-capable" />
<meta content="black" name="apple-mobile-web-app-status-bar-style" />
<meta content="telephone=no" name="format-detection" />
<script type="text/javascript" src="../js/jquery-1.7.1.min.js"
	charset="UTF-8"></script>
<script type="text/javascript" src="../js/core-1.0.js" charset="UTF-8"></script>
<title>工易付-APP下载</title>
<style type="text/css">
body {
	margin: 0;
	padding: 0;
	background:#3399ff;
	text-align: center;
}
.logo-box{
	margin: 20px;
	text-align: center;
}
img.img-logo{
	width: 120px;
	border-radius: 10px;
}
.desc-box{
	margin-top:30px;
	font-weight: 700;
	font-size: 20px;
	line-height: 20px;
	color: #cccc00;
}
.dowDiv{
	margin: 20px;
}
.dowBox{
	margin-top:50px;
	text-align: center;
}
img.dowBtn {
	width: 180px;
}

.mask {
	position: fixed;
	top: 0;
	z-index: 100;
	margin: 0;
	width: 100%;
	height: 100%;
	background: black;
	opacity: 0.8;
	display: none;
}

img.desc {
	width: 290px;
	position: absolute;
	top: -30px;
	right: -10px;
}
</style>
</head>
<body>
	<div class="bg">
		<div class="logo-box">
		</div>
		
		<div class="desc-box">
			安全、便捷支付
		</div>
		
		<div class="dowBox">
			<div class="dowIos dowDiv">
				<div class="iosDiv">
					<a
						href="">
						<img alt="苹果下载" src="../images/appdowload/ios.png" class="dowBtn"
						onclick="openDowload(event,1)" />
					</a>
				</div>
			</div>
			
			<div class="dowAndrord dowDiv">
				<div class="androidDiv">
					<a href="">
						<img alt="安卓下载" src="../images/appdowload/android.png"
						onclick="openDowload(event,2)" class="dowBtn">
					</a>
				</div>
			</div>
		</div>
		
	<div class="mask" id="mask" onclick="hideMask()">
		<img alt="" class="desc" src="../images/appdowload/desc.png">
	</div>

	<script type="text/javascript">
		var browser = {
			versions : function() {
				var u = navigator.userAgent, app = navigator.appVersion;
				return { //移动终端浏览器版本信息 
					ios : !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端 
					android : u.indexOf('Android') > -1
							|| u.indexOf('Linux') > -1, //android终端或uc浏览器 
					iPhone : u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器 
					iPad : u.indexOf('iPad') > -1, //是否iPad 
				};
			}(),
		}
		//判断是否在微信中打开
		function isWeiXin() {
			var ua = window.navigator.userAgent.toLowerCase();
			if (ua.match(/MicroMessenger/i) == 'micromessenger') {
				return true;
			} else {
				return false;
			}
		}

		function stopDefault(e) {
			e.stopPropagation();
			if (e && e.preventDefault) {
				e.preventDefault();
			} else {
				window.event.returnValue = false;
			}
			return false;
		}

		function openDowload(event, type) {
			if (isWeiXin()) {
				//苹果暂时无法下载，直接链接到web版本
				/* if (type == "1") {//其他设备上下载苹果
					stopDefault(event);
					alert("由于苹果下载服务器正在升级，请您先使用网页版口袋支付,感谢您的理解与支持!");
					//if(confirm("由于苹果下载服务器正在升级，您是否打开网页版口袋支付？")){
						window.location = kdPayUrl;
					//}
				} */
				stopDefault(event);
				showMask();
				return false;
			}
			//如果是苹果设备
			if (browser.versions.iPhone || browser.versions.iPad
					|| browser.versions.ios) {
				if (type == "2") {//苹果上下载安卓
					stopDefault(event);
					alert("苹果设备无法打开或安装安卓应用");
				}
				//苹果暂时无法下载，直接链接到web版本
				/* if (type == "1") {//其他设备上下载苹果
					stopDefault(event);
					alert("由于苹果下载服务器正在升级，请您先使用网页版口袋支付,感谢您的理解与支持!");
					//if(confirm("由于苹果下载服务器正在升级，您是否打开网页版口袋支付？")){
						window.location = kdPayUrl;
					//}
				} */
			} else {
				/* if (type == "1") {//其他设备上下载苹果
					stopDefault(event);
					alert("要安装苹果版应用请直接用您的苹果设备打开本页面进行下载安装");
				} */
			}
			return false;
		}

		function getMask() {
			return document.getElementById("mask");
		}

		function showMask() {
			var mask = getMask();
			mask.style.display = "block";
		}

		function hideMask() {
			mask.style.display = "none";
		}
		
		//下载地址配置
		var dowUrlConfig = {
			"2015000000" : {
				iosUrl : "",
				androidUrl : ""
			}
		};
		
		//下载页面的logo
		if(isOem()){
			var oem_id = $.getCookie("_oemId");
			formSubmitForAjax({
				url : BASE_PATH + 'AG0001.web',
				data : {agentId:oem_id},
				success : function(json){
					if(codeSuccess(json)){//查询成功
						var agent = json;
						//alert(agent['oemState'] + ' - ' + agent['oemPicId']);
						var imgSrc = "../images/logo-title.png";
						var oemName = '浙江树根';
						
						//如果是oem代理商
						if(agent['oemState'] == 1){
							if(agent['oemPicId']){
								imgSrc = BASE_PATH + 'mpbase/pic/view2.json?picid=' + agent['oemPicId'];
							}
							
							/* if(agent['agentName']){
								oemName = agent['agentName'];
								$.setCookie('_oemName',encodeURI(oemName));
							} */
						}
						//alert($.getCookie('_oemName'));
						$('.logo-box').append('<img src="' + imgSrc + '" class="img-logo"/>');
					}
				}
			});
		}else{
			$('.logo-box').append('<img src="../images/logo-title.png" class="img-logo"/>');
			/* $('.logo-text').append('浙江树根收银台'); */
		}
		
		//下载地址动态配置
		var oemId = $.getCookie("_oemId");
		if(!oemId){
			oemId = SYS_AGENT_ID;
		}
		var dowUrlObj = dowUrlConfig[oemId];
		if(dowUrlObj){
			$("a",$(".dowIos")).attr("href",dowUrlObj['iosUrl']);
			$("a",$(".dowAndrord")).attr("href",dowUrlObj['androidUrl']);
		}
	</script>
</body>
</html>